(function (line) {
    var StringProto = String.prototype;
    line.extend(line, {
        /**
         * Judge if the string1 contains the string2.
         * @param {String} string1
         * @param {String} string2
         * @return {Boolean}
         */
        contains:function (string1, string2) {
            return string1.indexOf(string2) > -1;
        },
        /**
         * Judge if string1 stat with string2.
         * @param {String} string1
         * @param {String} string2
         * @return {Boolean}
         */
        startsWith:function (string1, string2) {
            return string1.indexOf(string2) === 0;
        },
        /**
         * Judge if string1 end with string2.
         * @param {String} string1
         * @param {String} string2
         * @return {Boolean}
         */
        endsWith:function (string1, string2) {
            var index = string1.lastIndexOf(string2);
            return index > 0 && index == (string1.length - string2.length);
        },
        /**
         * Translate the string to a camelize type string.
         * @param {String} string
         * @return {String}
         */
        camelize:function (string) {
            return string.replace(/-(\w)/ig, function (str, $1) {
                return $1.toUpperCase();
            });
        },
        /**
         * Translate a camelize type string to string with '-'.
         * @param {String} string
         * @return {String}
         */
        decamelize:function (string) {
            return string.replace(/([A-Z])/g, function ($1) {
                return '-' + $1.toLowerCase();
            });
        },
        /**
         * Upper case the first word of a string.
         * @param {String} string
         * @return {String}
         */
        capitalize:function (string) {
            return string.charAt(0).toUpperCase() + string.slice(1);
        },
        /**
         * Replace a string to you want with the arguments.
         * @param {String} format
         * @param {Mix} some params
         * @return {String}
         */
        format:function () {
            var format = arguments[0],
                args = Array.prototype.slice.call(arguments, 1);
            return format.replace(/\{(\d+)\}/g, function (m, i) {
                return args[i];
            });
        },
        /**
         * Fill your string with the correct length with your padChar on the left position.
         * @param {String} string
         * @param {Number} length
         * @param {String} padChar
         * @return {String}
         */
        padLeft:function (string, length, padChar) {
            return new Array(length - string.length + 1).join(padChar || ' ') + string;
        },
        /**
         * Fill your string with the correct length with your padChar on the right position.
         * @param {String} string
         * @param {Number} length
         * @param {String} padChar
         * @return {String}
         */
        padRight:function (string, length, padChar) {
            return string + new Array(length - string.length + 1).join(padChar || ' ');
        },
        /**
         * Filter the blank string on the left position.
         * @param {String} string
         * @return {Stirng}
         */
        trimLeft:(function () {
            return StringProto.trimLeft ? function (string) {
                return string.trimLeft();
            } : function (string) {
                return string.replace(/^\s+/, '');
            }
        }()),
        /**
         * Filter the blank string on the right position.
         * @param {String} string
         * @return {Stirng}
         */
        trimRight:(function () {
            return StringProto.trimRight ? function (string) {
                return string.trimRight();
            } : function (string) {
                return string.replace(/\s+$/, '');
            }
        }()),
        /**
         * Filter the blank string on the left and right position.
         * @param {String} string
         * @return {Stirng}
         */
        trim:(function () {
            return StringProto.trim ? function (string) {
                return string.trim();
            } : function (string) {
                return line.trimRight(line.trimLeft(string));
            }
        }())
    });
})(line);